# Maintainer: Norbert Pfeiler <norbert.pfeiler+aur ät gmail.com>

_realname=cotire
pkgbase=mingw-w64-${_realname}
pkgname="$MINGW_PACKAGE_PREFIX-$_realname"
_cotirever=1.8.1
_cmakever=3.17
_cmakegooduntil=3.18
pkgver=${_cotirever}_${_cmakever}
pkgrel=1
pkgdesc='CMake module to speed up builds (automated PCH, unity builds) (mingw-w64)'
arch=(any)
license=('custom')
conflicts=("$MINGW_PACKAGE_PREFIX-cmake<${_cmakever}" "$MINGW_PACKAGE_PREFIX-cmake>=${_cmakegooduntil}") # the Modules dir changes every major release
url='https://github.com/sakra/cotire'
source=("https://github.com/sakra/cotire/archive/${_realname}-${_cotirever}.tar.gz")
sha256sums=('79b976b9e822941e3e2a3d82881c5fbcfbc971156640cb745e74f845e764f192')

package() {
  cd "${_realname}-${_realname}-${_cotirever}"

  modules_dir="${pkgdir}${MINGW_PREFIX}/share/cmake-${_cmakever}/Modules/"
  mkdir -p ${modules_dir}
  cp CMake/cotire.cmake ${modules_dir}

  license_dir="${pkgdir}${MINGW_PREFIX}/share/licenses/cotire/"
  mkdir -p ${license_dir}
  cp license ${license_dir}
}
